home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / CBGRX103.ZIP / contrib / libgrx / test / curstest.c < prev    next >
Text File  |  1993-12-06  |  2KB  |  82 lines

  1. /** 
  2.  ** CURSTEST.C 
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24.  
  25. #include "test.h"
  26. #include "mousex.h"
  27.  
  28. char p16d[] = {
  29.     0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,
  30.     1,2,1,0,0,0,0,0,0,0,0,1,2,2,1,0,
  31.     1,2,2,1,0,0,0,0,0,0,1,2,0,0,2,1,
  32.     1,2,2,2,1,0,0,0,0,0,1,2,0,0,2,1,
  33.     1,2,2,2,2,1,0,0,0,0,0,1,2,2,1,0,
  34.     1,2,2,2,2,2,1,0,0,0,0,0,1,1,0,0,
  35.     1,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,
  36.     1,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
  37.     1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
  38.     1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,
  39.     1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,
  40.     1,2,2,2,2,1,1,1,1,1,1,0,0,0,0,0,
  41.     1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
  42.     1,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
  43.     1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
  44.     0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  45. };
  46.  
  47. TESTFUNC(cursortest)
  48. {
  49.     int bgc = GrAllocColor(0,0,128);
  50.     int fgc = GrAllocColor(255,255,0);
  51.     int msc[3];
  52.     GrCursor *cur;
  53.     int x,y;
  54.  
  55.     msc[0] = 2;
  56.     msc[1] = GrWhite();
  57.     msc[2] = GrAllocColor(255,0,0);
  58.     cur = GrBuildCursor(p16d,16,16,1,1,msc);
  59.     x = GrScreenX() / 2;
  60.     y = GrScreenY() / 2;
  61.     GrMoveCursor(cur,x,y);
  62.     GrClearScreen(bgc);
  63.     drawing(0,0,GrSizeX(),GrSizeY(),fgc,GrNOCOLOR);
  64.     GrDisplayCursor(cur);
  65.     for( ; ; ) {
  66.         switch(getkey()) {
  67.         case 'u': y--; break;
  68.         case 'd': y++; break;
  69.         case 'l': x--; break;
  70.         case 'r': x++; break;
  71.         case 'U': y -= 10; break;
  72.         case 'D': y += 10; break;
  73.         case 'L': x -= 10; break;
  74.         case 'R': x += 10; break;
  75.         case 'q': return;
  76.         default:  continue;
  77.         }
  78.         GrMoveCursor(cur,x,y);
  79.     }
  80. }
  81.  
  82.